package tech.aistar.mapper.personal;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.personal.Purchase;

/**
 * Created by LJX on 2019/9/23.
 */
public interface PurchaseMapper {
    /**
     * 根据id查找订单
     * @param id
     * @return
     */
    @Select("select * from purchase where id = #{id}")
    Purchase findById(@Param("id") Integer id);
    /**
     * 更新  修改status = 1
     */
    @Update("update purchase set status = 1 where id = #{value} ")
    void update(Integer id);

    /**
     * 增加订单
     */
    @Insert("insert into purchase(ordno,time,user_id,ordercancel,status,ordmoney,payment,commentId) "+
            "values(#{ordno},#{time},#{userId},#{ordercancel},#{status},#{ordmoney},#{payment},#{commentId}) where id = #{id}")
    void save(Purchase purchase);

}
